{% extends "admin/base_site.html" %}

{% load i18n %}
{% load admin_urls admin_static admin_modify admin_list %}
{% load breadcrumbs %}

{% block extrastyle %}
  {{ block.super }}
  {% if cl.formset or action_form %}
    <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
  {% endif %}
{% endblock %}

{% block extrahead %}
{{ block.super }}
{{ media.js }}
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
<script type="text/javascript">
(function($) {
    $(document).ready(function($) {
        $("tr input.action-select").actions();
    });
})(django.jQuery);
</script>
{% endif %}{% endif %}
{% endblock %}

{% block breadcrumb-list %}
{% add_crumb 'Home' '/' %}
{% url 'admin:index' as admin_index %}
{% add_crumb 'Administration' admin_index %}
{% url 'admin:app_list' app_label=opts.app_label as app_list %}
{% add_crumb app_label|capfirst|escape app_list %}
{% add_crumb cl.opts.verbose_name_plural|capfirst %}
{% endblock %}

{% block object-tools %}
    {% if has_add_permission %}
    <li class="add">
        {% url cl.opts|admin_urlname:'add' as add_url %}
        <a title="{% trans 'Add' %}" href="{% add_preserved_filters add_url is_popup %}">
            {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
        </a>
    </li>
    {% endif %}
{% endblock %}

{% block content %}
{% if cl.formset.errors %}
    <p class="errornote">
    {% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
    {{ cl.formset.non_form_errors }}
    </p>
{% endif %}
<div class="{% if cl.has_filters %} filtered{% endif %}" id="changelist">
    {% block search %}{% search_form cl %}{% endblock %}
    {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}

    {% block filters %}
    {% if cl.has_filters %}
    <div id="changelist-filter">
        <h3>{% trans "Filters" %}:</h3>
        <ul>
            {% for spec in cl.filter_specs %}
            <li>{% admin_list_filter cl spec %}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}
    {% endblock %}

    <form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
    {% if cl.formset %}
        <div>{{ cl.formset.management_form }}</div>
    {% endif %}

    {% block result_list %}
        {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}
        {% result_list cl %}
        {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
    {% endblock %}
    {% block pagination %}{% pagination cl %}{% endblock %}
    </form>
</div>
{% endblock %}
